<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="cps">
<meta name="keywords" content="cps">
<title>{$system['m_name']}</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-title" content="cps">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta content="telephone=no" name="format-detection">
<link rel="stylesheet" type="text/css" href="__ROOT__/Public/css/fonta/iconfont.css">
<link href="__ROOT__/Public/css/css.css" rel="stylesheet">
<style type="text/css">
    .dl_div0{text-align: center;font-size: 30px;color: #333;line-height: 150px;}
    .dl_div1{border:1px solid #a6b2be;height: 40px;width: 84%;border-radius: 30px;margin:0 auto 10px;}
    .dl_d1_img1{width: 16px;float: left; margin:12px 8px 0 12px;}
    .dl_d1_input1{border:none;background: rgba(0,0,0,0);height: 40px;font-size: 14px;width: 84%;}
    .dl_d1_input2{border:none;background: rgba(0,0,0,0);height: 40px;font-size: 14px;width: 50%;}
    .dl_d1_p1{font-size: 14px;color: #1aa1f3;float: right;line-height: 40px;padding-right: 12px;}
    .dl_p1{color: #647686;height: 34px;float: right;margin-right: 10%;line-height: 34px;}
    .dl_div2{width: 84%;margin: 10px auto;background: -webkit-linear-gradient(left, #1aa1f3, #6783fb);background: -o-linear-gradient(left, #1aa1f3, #6783fb);background: -moz-linear-gradient(left, #1aa1f3, #6783fb);background: linear-gradient(to right, #1aa1f3, #6783fb);height: 40px;line-height: 40px;text-align: center;color: #fff;border-radius: 30px;}
    .dl_div3{width: 100%;line-height: 50px;text-align: center;color: #a6b2be;margin-top: 30px;}
    .dl_div4{width: 100%;text-align: center;}
    .dl_div4_img1{display: inline-block;border-radius: 100%;width: 44px;}
    .dl_p0{color: #647686;height: 34px;float: left;margin-left: 10%;line-height: 34px;}
</style> 
</head>
<body style="background:#fdfdfe;">
     
    <div class="dl_div0"><?php if(empty($system['m_name'])){echo '登录';}else{echo $system['m_name'];}?></div>
    
    <!--<div id="account_div">
	    <div class="dl_div1" style="margin-bottom:20px;">
	        <img src="__ROOT__/Public/images/zhanghao.png" class="dl_d1_img1">
	        <input class="dl_d1_input1" type="text" id="account" placeholder="请输入手机号" autocomplete="off">
	    </div>
	    <div class="dl_div1">
	        <img src="__ROOT__/Public/images/mima.png" class="dl_d1_img1">
	        <input class="dl_d1_input1" type="password" id="password" placeholder="请输入密码" autocomplete="off">
	    </div>
    </div>-->

    <div id="code_div">
	    <div class="dl_div1" style="margin-bottom:20px;">
	        <img src="__ROOT__/Public/images/shouji.png" class="dl_d1_img1">
	        <input class="dl_d1_input1" type="text" id="mobile" placeholder="请输入手机号" autocomplete="off">
	    </div>
	    <div class="dl_div1">
	        <img src="__ROOT__/Public/images/yanzhengma.png" class="dl_d1_img1">
	        <input class="dl_d1_input2" type="text" id="code" placeholder="请输入验证码" autocomplete="off">
	        <p class="dl_d1_p1" id="getcode" >获取验证码</p>
	    </div> 
    </div>
    
    <input type="hidden" id="check_style" value="psd">
    <if condition="$code_send eq '1'">
    <p class="dl_p0" id="toggle_check1">动态验证登录</p>
    </if>
    <p class="dl_p0" id="toggle_check2" style="display:none;">账号密码登录</p>
    <p class="dl_p1" onclick="javascript:location.href='{:U('Home/Mobile/Login/register',array('jsxcode'=>$jsxcode))}'">去注册</p>
    <div class="clear"></div>
    <div class="dl_div2" id="login">登录</div>
    <if condition="$Think.session.u_type == 'app'">  
	    <div class="dl_div3">———— 使用第三方登录 ————</div>
	    <div class="dl_div4"><img class="dl_div4_img1" onclick="location.href='{:U('Home/Mobile/Index/app_jump',array('partnerid'=>$partnerid))}'" src="__ROOT__/Public/images/wx-icon.png"/></div>
	 </if>
    <div class="idx_banquan"><p><a href="{$website['copyright_url']}"  style="color: #a9a2a2;">{$website['copyright']}</a></p></div>
    <!-- 提示 -->
	<div class="zhezhao_boxc">
	    <div class="opentcc"><p id="tips_content"></p></div>
	</div>
	<!-- 加载 -->
	<div class="zhezhao_boxa">
	    <div class="opentca"><img src="__ROOT__/Public/images/loading2.gif"></div>
	</div>
	<script language="javascript" src="__ROOT__/Public/js/jquery.js"></script>
	<script type="text/javascript">
		$("#toggle_check1").click(function(){
		    $("#code_div").show();
		    $("#account_div").hide();
		    $("#toggle_check1").hide();
		    $("#toggle_check2").show();
		    $("#check_style").val('cod');
		});
		
		$("#toggle_check2").click(function(){
			$("#account_div").show();
		    $("#code_div").hide();
		    $("#toggle_check1").show();
		    $("#toggle_check2").hide();
		    $("#check_style").val('psd');
		});
		
	    $("#getcode").on("click",function(){
	    	sendCode(this);
	    });
	    
	    var clock = '';
		var nums = 60;
		var btn;
		function sendCode(thisBtn) {
			var pattern = /^1\d{10}$/;
			var phone = $("#mobile").val();
			if(phone==''){
				$('#tips_content').html('请输入手机号！');
				$('.zhezhao_boxc').show();
				setTimeout(function(){
					$('.zhezhao_boxc').hide();
				},1500); 
				return false;
			}else{
				if(!pattern.test($.trim(phone))){
					$('#tips_content').html('请输入有效的手机号码！');
					$('.zhezhao_boxc').show();
					setTimeout(function(){
						$('.zhezhao_boxc').hide();
					},1500); 
					return false; 
				}
			}		  
			$.ajax({
				type: 'POST',
				url: "{:U('Home/Mobile/Login/sendsms')}",
				data: {'phone':phone},
				dataType: 'text',
				success: function(datas){
					if(datas=='1'){
						$('#tips_content').html('验证码发送成功！');
						$('.zhezhao_boxc').show();
						setTimeout(function(){
							$('.zhezhao_boxc').hide();
						},1500);
						btn = thisBtn;
						$(btn).off("click");
						btn.innerHTML = nums+'秒后重新获取';
						clock = setInterval(doLoop, 1000);
					}else{
						$('#tips_content').html(datas);
						$('.zhezhao_boxc').show();
						setTimeout(function(){
							$('.zhezhao_boxc').hide();
						},1500);
						return false; 
					}
				}	
			}); 
		}
		
		function doLoop() {
			nums--;
			if(nums > 0){
				btn.innerHTML = nums+'秒后重新获取'; 
			}else{
				clearInterval(clock); 
				$(btn).on("click",function(){
			    	sendCode(this);
			   });
				btn.innerHTML = '获取验证码';
				nums = 60; 
			}
		}
		
		$('#login').click(function(){					
			var phone = $("#mobile").val();
			var code = $("#code").val();	

			var pattern = /^1\d{10}$/;
			if(phone==''){
				$('#tips_content').html('请输入手机号！');
				$('.zhezhao_boxc').show();
				setTimeout(function(){
					$('.zhezhao_boxc').hide();
				},1500);
				return false;
			}else{
				if(!pattern.test($.trim(phone))){
					$('#tips_content').html('请输入有效的手机号码！');
					$('.zhezhao_boxc').show();
					setTimeout(function(){
						$('.zhezhao_boxc').hide();
					},1500);
					return false; 
				}
			}
		
			if(code==''){
				$('#tips_content').html('请输入验证码！');
				$('.zhezhao_boxc').show();
				setTimeout(function(){
					$('.zhezhao_boxc').hide();
				},1500);
				return false;
			}

		    $('.zhezhao_boxa').show();
			$.ajax({
				type: 'POST',
				url: "{:U('Home/Mobile/Login/dologin')}",
				data:{'phone':phone,'code':code},
				dataType: 'text',
				success: function(datas){
					$('.zhezhao_boxa').hide();	
					if(datas =='1'){
						$('#tips_content').html('登录成功');
						$('.zhezhao_boxc').show();
						setTimeout(function(){
							$('.zhezhao_boxc').hide();
							window.location.href="{:U('Home/Mobile/Index/index')}";
						},1500);
					}else if(datas =='2'){
						$('#tips_content').html('登录失败');
						$('.zhezhao_boxc').show();
						setTimeout(function(){
							$('.zhezhao_boxc').hide();
						},1500);
					}else{
						$('#tips_content').html(datas);
						$('.zhezhao_boxc').show();
						setTimeout(function(){
							$('.zhezhao_boxc').hide();
						},1500);
					}
					return false;
				}	
			});
		}) 
	</script>
</body>
</html>